package com.tapstitch.scm.common.utils.excel;




import com.tapstitch.scm.common.utils.excel.exception.ExcelException;

import java.util.List;

public class ExcelSheetModel<T>{

    protected String title;
    protected String footer;
    protected String sheetName;

    public List<T> rows;

    /** 导出特定的列 */
    protected List<String> specificColumnFields;

    private Class<T> rowDataClass;

    protected ExcelSheetModel(){

    }

    public ExcelSheetModel(String sheetName, List<T> rows){
        this(sheetName, rows, null);
    }

    public ExcelSheetModel(String sheetName, List<T> rows, List<String> specificColumnFields){
        this.sheetName = sheetName;
        this.rows = rows;
        if (rows == null || rows.size() <= 0){
            throw new ExcelException("导出数据为空");
        }
        this.rowDataClass = (Class<T>) rows.get(0).getClass();
        this.specificColumnFields = specificColumnFields;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getFooter() {
        return footer;
    }

    public void setFooter(String footer) {
        this.footer = footer;
    }

    public String getSheetName() {
        return sheetName;
    }

    public void setSheetName(String sheetName) {
        this.sheetName = sheetName;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public Class<T> getRowDataClass() {
        return rowDataClass;
    }

    public List<String> getSpecificColumnFields() {
        return specificColumnFields;
    }

    public void setSpecificColumnFields(List<String> specificColumnFields) {
        this.specificColumnFields = specificColumnFields;
    }

}
